package LoadBalanceRuler;

import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author yanan.li created on 2023/11/6
 * @version $Id$
 */
@Configuration
public class MyRule {
    //自定义负载均衡算法
    @Bean
    public IRule myRule(){
//        return RoundRobinRule();
//        return AvailabilityFilteringRule();
//        return new WeightedResponseTimeRule();
//        return new RetryRule();
//        return new BestAvailableRule();
//        return new ZoneAvoidanceRule();
        return new RandomRule();
    }
}
